<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<!--系统管理 菜单-->
<!-- Section - Bootstrap Brain Component -->
<section class="pb-3 pb-md-4 pb-xl-5 bg-light" th:fragment="MenuManage">
    <div class="container">
        <div class="row gy-3 gy-md-4">
            <!--<div class="col-12 col-lg-6">-->
            <div class="row gy-3 gy-md-4">
                <!--<div class="col-5">-->
                <div class="card widget-card border-light shadow-sm">
                    <div class="card-header bg-transparent p-3 border-light-subtle">
                        <h5 class="card-title widget-card-title m-0">系统菜单</h5>
                    </div>
                    <div class="card-body p-3">
                        <div class="accordion" id="accordionExample" th:each="item,stat: ${menuList}">
                            <div class="accordion-item" th:if="${#lists.isEmpty(item.parentId)}">
                                <div class="card widget-card border-light shadow-sm">
                                    <h2 class="accordion-header">
                                        <button th:class="${stat.index == 0?'accordion-button':'accordion-button collapsed'}" type="button" data-bs-toggle="collapse" th:data-bs-target="${'#' + item.menuMarks}" th:aria-expanded="${stat.index == 0}" th:aria-controls="${item.menuMarks}">
                                            [[${item.name}]]
                                        </button>
                                    </h2>
                                    <div th:id="${item.menuMarks}" th:class="${stat.index == 0?'accordion-collapse collapse show' :'accordion-collapse collapse'}" data-bs-parent="#accordionExample">
                                        <div class="accordion-body">
                                            <div class="row gy-10 gy-md-0 m-0">
                                                <!--<p class="card-body p-0">-->
                                                <table class="table table-hover">
                                                    <thead>
                                                    <tr>
                                                        <th scope="col">序号</th>
                                                        <th scope="col">菜单名称</th>
                                                        <th scope="col">标识</th>
                                                        <th scope="col">图标</th>
                                                        <th scope="col">操作</th>
                                                    </tr>
                                                    </thead>

                                                    <tbody th:if="${not #lists.isEmpty(item.childList)}" th:each="childItem : ${item.childList}">

                                                    <tr>
                                                        <th scope="row" th:text="${childItem.id}"></th>
                                                        <td th:text="${childItem.name}"></td>
                                                        <td th:text="${childItem.menuMarks}"></td>
                                                        <td>
                                                            <div class="nav-link-icon text-primary">
                                                                <i th:class="${childItem.menuIcon}"></i>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <div class="d-inline-flex gap-1 m-0">
                                                                <a th:href="@{menuEdit(id=${childItem.id})}" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">编辑</a>
                                                                <a th:href="@{menuDel(id=${childItem.id})}" class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">删除</a>
                                                            </div>
                                                        </td>
                                                    </tr>

                                                    <tr th:if="${not #lists.isEmpty(childItem.childList)}">
                                                        <td colspan="5">
                                                            <table class="table table-bordered table-hover">
                                                                <thead>
                                                                <tr>
                                                                    <th scope="col">编号</th>
                                                                    <th scope="col">名称</th>
                                                                    <th scope="col">标识</th>
                                                                    <th scope="col">操作</th>
                                                                </tr>
                                                                </thead>

                                                                <tbody th:each="grandsonItem : ${childItem.childList}">
                                                                <tr>
                                                                    <th scope="row" th:text="${grandsonItem.id}"></th>
                                                                    <td th:text="${grandsonItem.name}"></td>
                                                                    <td th:text="${grandsonItem.menuMarks}"></td>
                                                                    <td>
                                                                        <div class="d-inline-flex gap-1 m-0">
                                                                            <a th:href="@{menuEdit(id=${grandsonItem.id})}" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">编辑</a>
                                                                            <a th:href="@{menuDel(id=${grandsonItem.id})}" class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">删除</a>
                                                                        </div>

                                                                    </td>
                                                                </tr>
                                                                </tbody>
                                                            </table>
                                                        </td>
                                                    </tr>

                                                    </tbody>

                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
</section>

</html>